package day02;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DemoCount extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		ServletContext context = getServletContext();
		ServletConfig config = getServletConfig();
		config.getInitParameter("");
		context.getInitParameter("");
		
		System.out.println("context"+context);
		
		Integer count = (Integer) context.getAttribute("count");
		

		if (count == null) {
			context.setAttribute("count", 1);
		} else {
			context.setAttribute("count", count + 1);
		}
		
		System.out.println(count);
		
	}
}
